package com.wuren.faceSwiping.admin.controller;

import com.wuren.faceSwiping.admin.entity.User;
import com.wuren.faceSwiping.admin.service.UserService;
import com.wuren.faceSwiping.helper.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/user")
@CrossOrigin("*")
public class UserController {
    @Autowired
    private UserService userService;
    /**
     * 用户登录
     * @param user 用户的pojo
     * @return 成功或失败
     */
    @RequestMapping("/login")
    public ResponseBean signIn(User user) {
        //调用userServise类里的signIn方法 参数（用户pojo类）返回给 n
        //返回一个ResponseBean类（响应码，数据条数，结果） n>0 则成功 反之失败
        return new ResponseBean(200,1,userService.userLogin(user));
    }
}
